﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SynoManager.DownloadStation.Search
{
    public sealed class SearchManager
    {
        private ISearchEngine[] engines;

        public SearchManager()
        {
            var typeAttributeManager = new TypeAttributeManager<ISearchEngine, SearchEngineAttribute>();
            List<ISearchEngine> result = new List<ISearchEngine>();
            foreach(Type type in typeAttributeManager.Types)
            {
                ISearchEngine engine = (ISearchEngine) Activator.CreateInstance(type);
                result.Add(engine);
            }
            engines = result.ToArray();
        }

        public ISearchEngine[] Engines
        {
            get { return engines; }
        }
    }
}
